package cn.matezk.lianlian.model;

import cn.hutool.core.date.DatePattern;
import cn.hutool.json.JSONObject;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;

import java.util.Date;

@Data
public class Event {
    private String id;
    private String eventId;
    private String type;
    private String deviceId;
    private JSONObject params;
    @JsonFormat(pattern = DatePattern.NORM_DATETIME_PATTERN, timezone="GMT+8")
    private Date eventTime;

    public String getProductId() {
        return deviceId.split("/")[0];
    }

    public String getDeviceName() {
        return deviceId.split("/")[1];
    }
}
